package cate.game.role.res.treasureturntable.msg;

import cate.common.annotation.OperationSetter;
import cate.common.table.d.GDOperation;
import cate.common.util.GameResult;
import cate.game.GameBody;
import cate.game.client.ClientContext;
import cate.game.client.msg.ClientMsg;
import cate.game.client.msg.MsgConfig;
import cate.game.client.msg.MsgInput;
import cate.game.client.msg.id.MsgIdBTreasureTurntable;
import easy.java.dev.note.NoteField;

@ClientMsg(title = "转盘抽奖得请求")
@OperationSetter(GDOperation.TREASURE_TURNTABLE_DRAW_REWARD)
public class TreasureTurntableDrawItemReq implements MsgInput {
    @NoteField(value = "转盘类型")
    public byte turntableType;

    @NoteField(value = "1 单抽 2十连")
    public byte drawType;

    @Override
    public void execute(GameBody game, ClientContext cc) {
        GameResult<Void> r = cc.getRole().getRes().treasureTurntables.drawItems(turntableType, drawType);
        if (!r.ok()) {
            game.notice.message(cc.getRole(), r);
        }
    }

    @Override
    public MsgConfig conf() {
        return MsgIdBTreasureTurntable.DRAW_REQ;
    }
}
